from typing import *


class Solution:

    def countInterestingSubarrays(self, nums: List[int], modulo: int,
                                  k: int) -> int:
        cnt = 0
        h = Counter()
        ans = 0
        h[0] = 1
        for num in nums:
            cnt += num % modulo == k
            ans += h[((cnt % modulo) - k + modulo) % modulo]
            h[cnt % modulo] += 1

        return ans